home *** CD-ROM | disk | FTP | other *** search
/ Champak Vol F-12 / (Vol F-12) Jun 02 2012.iso / Screensaver / screensaver_installer.exe / ____swmx / scripts / frame_1 / DoAction_15.as < prev    next >
Text File  |  2004-10-21  |  2KB  |  74 lines

  1. _global.ScreenweaverMenu = function()
  2. {
  3.    this.init();
  4. };
  5. ScreenweaverMenu.prototype.init = function()
  6. {
  7.    ASBroadcaster.initialize(this);
  8. };
  9. ScreenweaverMenu.prototype.registerMenu = function(menuData, userCallback, scope)
  10. {
  11.    this.__parseMenuData.callback = callback;
  12.    delete this.__parseMenuData.result;
  13.    callback = function(s, i)
  14.    {
  15.       if(!s)
  16.       {
  17.          return undefined;
  18.       }
  19.       us = arguments.callee;
  20.       if(us.menus[us.counter].parent)
  21.       {
  22.          us.menus[us.counter].parent.submenu = i;
  23.       }
  24.       us.counter = us.counter + 1;
  25.       if(us.counter < us.menus.length)
  26.       {
  27.          swInterface.callMethod("createCustomPopup",us.menus[us.counter],us);
  28.       }
  29.       else
  30.       {
  31.          us.userCallback.apply(us.userScope,[s,i]);
  32.       }
  33.    };
  34.    callback.menus = this.__parseMenuData(menuData);
  35.    callback.counter = 0;
  36.    callback.userCallback = userCallback;
  37.    callback.userScope = scope;
  38.    swInterface.callMethod("createCustomPopup",callback.menus[0],callback);
  39. };
  40. ScreenweaverMenu.prototype.__parseMenuData = function(menuData, parent)
  41. {
  42.    if(!arguments.callee.result)
  43.    {
  44.       arguments.callee.result = [];
  45.    }
  46.    var thisMenu = [];
  47.    thisMenu.parent = parent;
  48.    var i = 0;
  49.    while(i < menuData.length)
  50.    {
  51.       var thisItem = {caption:menuData[i].caption,callbackID:(typeof menuData[i].callback ne "function" ? menuData[i].callback : swInterface.addCallback(menuData[i].callback,true,menuData[i].scope)),scope:menuData[i].scope,submenu:0};
  52.       if(menuData[i].submenu)
  53.       {
  54.          arguments.callee.apply(this,[menuData[i].subMenu,thisItem]);
  55.       }
  56.       thisMenu.push(thisItem);
  57.       i++;
  58.    }
  59.    arguments.callee.result.push(thisMenu);
  60.    return arguments.callee.result;
  61. };
  62. ScreenweaverMenu.prototype.setWindowMenu = function(menuId)
  63. {
  64.    getURL("FSCommand:sw_selectWindowMenu",menuId);
  65. };
  66. ScreenweaverMenu.prototype.setPopupMenu = function(menuId)
  67. {
  68.    getURL("FSCommand:sw_selectCustomPopup",menuId);
  69. };
  70. ScreenweaverMenu.prototype.showPopupMenu = function(menuId)
  71. {
  72.    getURL("FSCommand:sw_showCustomPopup",menuId);
  73. };
  74.